<?php 
      echo $this->Html->css("chosen");
      echo $this->Html->css("uploadify");
      echo $this->Html->css("jquery.cleditor");
      echo $this->Html->css("validationEngine.jquery");
 ?>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/customInput.jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/chosen.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.filestyle.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/zice.custom1.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.cleditor.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/manager_News.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine-vi.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.autotab.js"></script>
<script type="text/javascript" >
$(function() {
	$("#fileupload").uploadify({
			'fileTypeDesc' : 'Image Files',
	        'fileTypeExts' : '*.jpg', 
			'swf'      : '<?php echo $this->webroot; ?>js/uploadify/uploadify.swf',
			'uploader' : '<?php echo $this->webroot; ?>js/uploadify/uploadify.php',
			'onUploadSuccess' : function(file, data, response) {
				if(data == 1){
					$('#resultUpload').html("<p>Upload hình thành công</p><img src='<?php echo $this->webroot; ?>img/news/" + file.name +"'/><input id='filenameUpload' type='hidden' value='"+file.name+"'/>");
				}
				else{
					$('#resultUpload').html("<p>Định dạng hình không đúng.</p>");
				}
	        } 
		});
});
</script>
<div class="titlePage">
<h1>Thêm mới bài viết</h1>
</div>
<div class="onecolumn">
	<div class="header">
		<span><span class="ico gray group"></span>Bài viết</span>
	</div>
	<div class=" clear"></div>
	<div class="content">
		<form id="validation">
			<div class="newNews">
				<h4>Bài viết mới</h4>
				<div class="section">
					<label>
					Tên bài viết:
					
					</label>
					<div>
						<input class="validate[required] large" type="text" id="news_name">
						
					</div>
				</div>
				<div class="section">
					<label>
					Tên thay thế:
					
					</label>
					<div>
						<input class="validate[required] large" type="text" id="news_alias">
						
					</div>
				</div>
				<div class="section">
					<label>
					Loại bài viết:
					
					</label>
					<div id="search_news_type">
						 <select data-placeholder="Chọn loại bài viết..." class="chzn-select choose_news_type" tabindex="2" >
	                          <option value=""></option> 
	                          <?php foreach ($news_types as $item) {?>
								<option value="<?php echo $item['t']['id']; ?>"><?php echo $item['t']['name'];}?></option>
	                     </select>					
					</div>
				</div>
				<div class="section">
					<label>
					Mô tả:
					
					</label>
					<div>
						<input class="validate[required] large" type="text" id="news_des">
						
					</div>
				</div>
				<div class="section ">
                    <label> Hình ảnh: </label>   
                    <div> 
                    	<input type="file" class="fileupload" id="fileupload"/>
                    </div>
                    <div id="resultUpload">
                    </div>
                </div>
				<div class="section">
					<label>
					Nội dung bài viết:				
					</label>
					<div>
						<textarea name="editor" id="editor"  class="editor"  cols="" rows=""></textarea>					
					</div>
				</div>
				<div id='alert_news'></div>
				<div class="buttonNewNews">
					<a class="uibutton add_news"><span class="ico gray checkmark2"></span>Lưu</a>
					<a class="uibutton special cancel"><span class="ico gray cross"></span>Hủy</a>
				</div>
			</div>
		</form>
		<div class="clear"/></div>  
	</div>
</div>